package be.kuleuven.cs.mop.gui.components;


import java.awt.Font;

import javax.swing.JComboBox;



public class NumericComboBox extends JComboBox {
	private static final long serialVersionUID = 1L;
	
	private final int offset;
	
	
	protected NumericComboBox(final int offset, final int size) {
		super(generate(offset, size));
		this.offset = offset;
		
		setFocusable(false);
		setFont(new Font("Helvetica", Font.BOLD, 14));
	}
	
	
	
	private static final String[] generate(final int init, final int size) {
		final String[] r = new String[size];
		for (int i = 0; i < size; i++)
			r[i] = Integer.toString(init + i);
		return r;
	}
	
	public int read() { return (offset + getSelectedIndex()); }
	
}